package com.example.scheduled;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.DefaultApplicationArguments;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.StopWatch;

import java.math.BigDecimal;

/**
 * @program: demo
 * @description:
 * @author: Mr.Wang
 * @create: 2019-04-25 15:13
 **/
public class User {

    private String name;
    private Long age;
    private BigDecimal money ;
    private String sex;

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }



    public void setSex(String sex) {
        this.sex = sex;
    }

    public Long getAge() {
        return age;
    }

    public void setAge(Long age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "age:"+age+",money:"+money;
    }



/*public ConfigurableApplicationContext run(String... args) {
       StopWatch stopWatch = new StopWatch(); // 构造一个任务执行观察器
        stopWatch.start(); // 开始执行，记录开始时间
        ConfigurableApplicationContext context = null;
        configureHeadlessProperty();
        // 获取SpringApplicationRunListeners，内部只有一个EventPublishingRunListener
        SpringApplicationRunListeners listeners = getRunListeners(args);
        // 上面分析过，会封装成SpringApplicationEvent事件然后广播出去给SpringApplication中的listeners所监听
        // 这里接受ApplicationStartedEvent事件的listener会执行相应的操作
        listeners.started();
        try {
            // 构造一个应用程序参数持有类
            ApplicationArguments applicationArguments = new DefaultApplicationArguments(
                    args);
            // 创建Spring容器
            context = createAndRefreshContext(listeners, applicationArguments);
            // 容器创建完成之后执行额外一些操作
            afterRefresh(context, applicationArguments);
            // 广播出ApplicationReadyEvent事件给相应的监听器执行
            listeners.finished(context, null);
            stopWatch.stop(); // 执行结束，记录执行时间
            if (this.logStartupInfo) {
                new StartupInfoLogger(this.mainApplicationClass)
                        .logStarted(getApplicationLog(), stopWatch);
            }
            return context; // 返回Spring容器
        }
        catch (Throwable ex) {
            handleRunFailure(context, listeners, ex); // 这个过程报错的话会执行一些异常操作、然后广播出ApplicationFailedEvent事件给相应的监听器执行
            throw new IllegalStateException(ex);
        }
    }
*/


}
